package com.jsb.laundry.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jsb.laundry.model.dto.posts.PostQueryRequest;
import com.jsb.laundry.model.entity.JsbPosts;
import com.jsb.laundry.model.vo.PostsVO;

import javax.servlet.http.HttpServletRequest;

/**
* @author ching
* @description 针对表【jsb_posts(帖子表)】的数据库操作Service
* @createDate 2023-08-09 14:06:04
*/
public interface JsbPostsService extends IService<JsbPosts> {
    /**
     * 校验
     *
     * @param posts
     * @param add
     */
    void validPost(JsbPosts posts, boolean add);

    /**
     * 获取查询条件
     *
     * @param postQueryRequest
     * @return
     */
    QueryWrapper<JsbPosts> getQueryWrapper(PostQueryRequest postQueryRequest);

    /**
     * 获取帖子封装
     *
     * @param loginUserId
     * @param post
     * @param request
     * @return
     */
    PostsVO getPostVO(String loginUserId,JsbPosts post, HttpServletRequest request);

    /**
     * 分页获取帖子封装
     *
     * @param loginUserId
     * @param postPage
     * @param request
     * @return
     */
    Page<PostsVO> getPostVOPage(String loginUserId, Page<JsbPosts> postPage, HttpServletRequest request);

    /**
     * 获取用户所有发帖的点赞数量
     *
     * @param userId
     * @return
     */
    int getLikesReceivedNum (String userId);
}
